﻿using System;
using Autodesk.Revit.DB;

namespace YArchitech.HVAC.AuxiliaryCurve
{
	public class OrdinaryHandle : AuxiliaryHandldSelPoints
	{
		public OrdinaryHandle(ref XYZ minArgu, ref XYZ maxArgu, double xSideArgu, double ySideArgu, bool bIsNumberSet = false)
		{
			this.Handle(ref minArgu, ref maxArgu, xSideArgu, ySideArgu, bIsNumberSet);
		}

		private bool Handle(ref XYZ min, ref XYZ max, double xSide, double ySide, bool bIsNumberSet = false)
		{
			double num = (min.X > max.X) ? max.X : min.X;
			double num2 = (min.X < max.X) ? max.X : min.X;
			double num3 = (min.Y > max.Y) ? max.Y : min.Y;
			double num4 = (min.Y < max.Y) ? max.Y : min.Y;
			if (bIsNumberSet)
			{
				min = new XYZ(num + xSide, num3 + ySide, 0.0);
				max = new XYZ(num2 - xSide, num4 - ySide, 0.0);
			}
			else
			{
				min = new XYZ(num + xSide, num3, 0.0);
				max = new XYZ(num2, num4 - ySide, 0.0);
			}
			return true;
		}
	}
}
